
package com.hyts.dess.base.bean.resp;

import com.hyts.dess.base.bean.TraceHolder;
import com.hyts.dess.base.constant.DessErrorEnum;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * @project-name:dess
 * @package-name:com.hyts.dess.bean.resp
 * @author:LiBo/Alex
 * @create-date:2020-06-23 19:57
 * @copyright:libo-alex4java
 * @email:liboware@gmail.com
 * @description:
 */
@Accessors(chain = true)
@Getter
@Setter
public class DessResponse<T> extends TraceHolder {

    /** 成功标识 */
    private boolean success;

    /** 错误码 */
    private String code;

    /** 错误描述 */
    private String message;

    /** 返回数据 */
    protected T data;

    /**
     * 构造器
     * @param errorEnum
     */
    public DessResponse(DessErrorEnum errorEnum){
        this.success = false;
        this.code = errorEnum.getCode();
        this.message = errorEnum.getDesc();
    }

}
